<?php

namespace MoChat\App\Sales\Service;

use MoChat\App\Sales\Contract\CallRecordContract;
use MoChat\App\Sales\Model\CallRecord;
use MoChat\Framework\Service\AbstractService;

class CallRecordService extends AbstractService implements CallRecordContract
{
    /**
     * @var CallRecord
     */
    protected $model;

    public function getList($where, array $filed = ['*']): array
    {
        return $this->model->getPageList($where, $filed, ['orderByRaw' => 'created_time desc']);
    }

    public function getListAll($where, array $filed = ['*']): array
    {
        $all = $this->model->where($where)->select($filed)->orderBy('created_time', 'desc')->get();
        return empty($all) ? [] : $all->toArray();
    }
}